package com.spsy.pay.listener;

import com.rabbitmq.client.Channel;
import com.spsy.pay.constant.RabbitmqConstantCompany;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;


@Component
@RabbitListener(queues = RabbitmqConstantCompany.RabbitMqConstantCompany.MQ_NAME)
@Slf4j
public class RabbitLisenerCompany {


    @RabbitHandler
    public void  handler(String str, Channel channel, Message message) throws Exception {
        log.info("接收到的消息是："+str);

        //sucess
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),true);

//        channel.basicNack(message.getMessageProperties().getDeliveryTag(),false,false);
//
//        channel.basicNack(message.getMessageProperties().getDeliveryTag(),false,true);


    }
}

